#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main(){
  pid_t ret = fork();
  if(ret == 0){
    //子进程
    while(1){
      printf("child ,pid: %d ,ppid: %d\n",getpid(),getppid());
      sleep(1);
    }
    
  }else if(ret > 0){
    //父进程
    while(1){
      printf("parent ,pid: %d ,ppid: %d\n",getpid(),getppid());
      sleep(1);
    }
  }else{
    perror("error!\n");
  }
  return 0;
}
